import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 抓娃娃
 * User: DELL
 * Date: 2024-05-23
 * Time: 21:53
 */
public class Main8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[][] arr = new int[n][2];
        for (int i = 0; i < n; i++) {
            arr[i][0] = scanner.nextInt();
            arr[i][1] = scanner.nextInt();
        }
        while (m-- > 0) {
            int res = 0;
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                if (arr[i][1] <= l || arr[i][0] >= r) {
                    continue;
                }
                // 计算重叠的长度
                int left = Math.max(l, arr[i][0]);
                int right = Math.min(r, arr[i][1]);
                if ((right - left) * 2 >= arr[i][1] - arr[i][0]) {
                    res++;
                }
            }
            System.out.println(res);
        }
    }
}
